@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>AddressSearchAccordion</title>
</head>
<body>
    <script type="text/javascript">

        jQuery(document).ready(function () {
            $("#Nav").hide();
            $("#tenantaccordion3").accordion();
            $("#tenantaccordion2").accordion();
            
            $('#trgSearch').click(function (event) {
var myUrl ="./Tenant/Search?TenantName=" + $("#TenantName").val();
                $.ajax({
                    url: '@Url.Content("~/Tenant/TenantGrid/")',
                    cache: false,
                    success: function (html) {
                        $("#tenantaccordion3").accordion("activate", 1);
                        $('#Tenantsearch').html(html);
                        $("#tenantlist").setGridParam({ datatype: 'json', url: myUrl }).trigger("reloadGrid");
                        $('#tenantlist').jqGrid('setGridParam', { onSelectRow: function (ids) {
                        TenantID = ids ;
                            $.ajax({
                                url: '@Url.Content("~/Tenant/TenantDetails/")' + TenantID,
                                cache: false,
                                success: function (html) {
                                    $('#Tenantreview').html(html);

                                }
                            });
                            $("#tenantaccordion3").accordion("activate", 2);
                        }
                        });
                    }
                });

            });

			 $('#Details').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Tenant/TenantDetails/")' + TenantID,
					cache: false,
					success: function (html) {
					$('#Dialog').html(html);
					$('#Dialog').dialog({modal:true});
					return false;
				}});
			});
			 $('#Add').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Tenant/NewTenantForm/")',
					cache: false,
					success: function (html) {
					$('#Dialog').html(html);
					$('#Dialog').dialog({modal:true});
					return false;
				}});
			});
			 $('#Update').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Tenant/UpdateTenantForm/")' + TenantID,
					cache: false,
					success: function (html) {
					$('#Dialog').html(html);
					$('#Dialog').dialog({modal:true});
					return false;
				}});
			});
			 $('#Search').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Tenant/TenantSearch/")' + TenantID,
					cache: false,
					success: function (html) {
					$('#Main').html(html);
					return false;
				}});
			});
			 $('#Remove').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Tenant/RemoveTenantForm/")' + TenantID,
					cache: false,
					success: function (html) {
					$('#Dialog').html(html);
					$('#Dialog').dialog({modal:true});
					return false;
				}});
			});
						 $('#Application1').click(function(event) {
								$.ajax({
									url: '@Url.Content("~/Application/ApplicationGrid/")',
									cache: false,
									success: function (html) {
									$('#Main').html(html);
									$("#applicationlist").setGridParam({ datatype: 'json', url: "./Application/GetBy_Tenant_Application_ByParent/" + TenantID }).trigger("reloadGrid");
									return false;
								}});
								$.ajax({
									url: '@Url.Content("~/Application/ApplicationAccordion/")',
									cache: false,
									success: function (html) {
									$('#Nav').html(html);
									$('#Nav').show();
									return false;
								}});
							});
						        });
						    </script>
						    <div id="tenantaccordion3">
								<h3><a href="#">Step 1: tenant Search</a></h3>
							    <div>
						            Tenant Name: <input type="text" name="TenantName" id="TenantName" />
						            <input type="button" value="Search" id="trgSearch" />
						        </div>
						
						        <h3><a href="#">Step 2: tenant Select</a></h3>
							    <div>
						           <div id="Tenantsearch"></div>
						        </div>
						
						        <h3><a href="#">Step 3: tenant Review</a></h3>
							    <div>
						           <div id="Tenantreview"></div>
						        </div>
						
						        <h3><a href="#">Step 4: tenant Relationships</a></h3>
							    <div>
						           <div id="Tenantrelate">
						            <div id="tenantaccordion2">
						    <h3><a href="#">Edit Options</a></h3>
						     <ul>
						<li><a href="#" id="Add">Add</a></li>
						<li><a href="#" id="Update">Update</a></li>
						<li><a href="#" id="Search">Search</a></li>
						<li><a href="#" id="Remove">Remove</a></li>
						<li><a href="#" id="Details">Details</a></li>
								
							 </ul>
							 
							  <h3><a href="#">Related Items</a></h3>
							  <ul>
									 <li><a href="#" id='Application1'>Application</a></li>
						               
						            </ul>
						    </div>
						            </div>
						        </div>
						    </div>
						</body>
						</html>